package thread;


import java.util.Scanner;

/**
 * 线程的静态方法：
 * static void sleep(long ms)
 * 该方法可以让运行这个方法的线程处于阻塞状态指定毫秒
 */
public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了！");
        Scanner scan = new Scanner(System.in);
        System.out.println("输入时间：");
        int time = scan.nextInt();
        for (int i = time; i > 0; i--) {
            System.out.println(i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("程序结束了！");
    }
}
